package cn.itcast.employmanager.dao;

import java.sql.SQLException;
import java.util.List;

import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanListHandler;

import cn.itcast.employmanager.domain.Department;
import cn.itcast.employmanager.utils.C3p0Util;

public class DepartmentDAO {
	
	// 获取所有部门
	public List<Department> findAllDepartments() throws SQLException {
		String sql = "select * from department";
		QueryRunner runner = new QueryRunner(C3p0Util.getDataSource());
		return runner.query(sql, new BeanListHandler<Department>(Department.class));
	}
}
